package com.ls.controller.example;

import com.ls.controller.example.model.AddExampleModel;
import com.ls.controller.example.model.EditExampleModel;
import com.ls.controller.example.model.QueryExampleModel;
import com.ls.controller.example.model.updateStatusModel;
import com.ls.service.IExampleService;
import com.ls.utils.ResultData;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 示例 前端控制器
 * </p>
 *
 * @author pengyu
 * @since 2024-10-12
 */
@Api(value = "PC示例相关接口", tags = "PC示例相关接口")
@RestController
@RequiredArgsConstructor
@RequestMapping("/example")
public class ExampleController {
    private final IExampleService service;
    /** 新增示例  */
    @PostMapping("add")
    public ResultData add(@Valid @RequestBody AddExampleModel model) {
        return service.add(model);
    }

    /** 更新示例  */
    @PostMapping("edit")
    public ResultData edit(@Valid @RequestBody EditExampleModel model) {
        return service.edit(model);
    }
    /** 查看示例  */
    @GetMapping("pageList")
    public ResultData pageList() {
        return service.pageList();
    }
    /**修改示例启用状态*/
    @PostMapping("updateStatus")
    public ResultData updateStatus(@Valid @RequestBody updateStatusModel model) {
        return service.updateStatus(model);
    }
    /** 删除示例  */
    @PostMapping("del")
    public ResultData del(@RequestBody Long exampleId) {
        return service.del(exampleId);
    }
}